//
//  HPSwipeServiceProtocal.h
//  HandPaySwiperModule
//
//  Created by marco on 14/12/9.
//  Copyright (c) 2014年 marco. All rights reserved.
//

#ifndef HandPaySwiperModule_HPSwipeServiceProtocal_h
#define HandPaySwiperModule_HPSwipeServiceProtocal_h

/**
 刷卡器连接状态
 **/
typedef enum {
    SwiperStateLowBattery       = -4, //电量低
    SwiperStateConnectCanceled  = -3,// 用户取消
    SwiperStateNoDeviceDected   = -2, // 已断开
    SwiperStateConnectFailed    = -1, // 连接失败
    SwiperStateDectedDevice     = 0, // 已检测设备
    SwiperStateConnecting       = 1, // 正在连接
    SwiperStateConnected        = 2, // 已插入设备
} SwiperState;

/**
 刷卡器CSN激活状态
 **/
typedef enum
{
    CSNStatusUnknow = -1,
    CSNStatusNone = 0,              // 原始
    CSNStatusAvailable,             // 可用
    CSNStatusUnbound,               // 未绑定
    CSNStatusBoundOtherUser,        // 绑定到其他渠道
    CSNStatusBoundOtherChannel,     // 绑定到其他用户
    CSNStatusLoss,                  // 挂失
    CSNStatusLogOut,                // 注销
} CSNStatus;

typedef enum
{
    SwiperTypeNone,
    SwiperTypeBBPOS,                //智嘉刷卡器（支持ic）
    SwiperTypeZhijia,               //智嘉刷卡器（不支持ic）
    SwiperTypeNewLand               //新大陆刷卡器
} SwiperType;


//@protocol HPSwipeServiceDelegate <NSObject>
//@end


@class POSProcess, HPSwiperResult;

@protocol HPSwipeServiceProtocal <NSObject>
@property (readonly, nonatomic) CSNStatus csnStatus;
@property (readonly, strong, nonatomic) NSString * csn;
@property (readonly, nonatomic) SwiperState swiperConnectState;
//@property (nonatomic, weak) id<HPSwipeServiceDelegate> delegate;

- (void)checkAndConnectSwiper:(void(^)(HPSwiperResult*))complete; // not public method
- (void)doSwiper:(void(^)(HPSwiperResult*))complete; // 实施刷卡
- (void)doEncyptPin:(NSString *)pin complete:(void(^)(HPSwiperResult*))complete;
- (void)doInputICPin:(NSString *)pin complete:(void(^)(HPSwiperResult*))complete;
- (void)doInputPwdWithAmount:(NSString *)amount complete:(void(^)(HPSwiperResult*))complete;
- (void)doMac:(NSString*)data complete:(void(^)(HPSwiperResult*))complete;
- (NSString *)resetFactor;
- (NSString*)getFatorTime;
- (void)setCsnStatus:(CSNStatus)csnStatus;
- (BOOL)cancelSwiperOperation;
- (void)startProcess:(POSProcess *)process;
- (NSString *)icQuestInputPin;
- (void)doSelectApp:(NSArray*)type complete:(void (^)(HPSwiperResult*))complete; //在刷卡设备支持列表中选择刷卡器

/**
 HPSwipeContext responsablity to instance an swiper instnce. 
 more detail watch:'HPSwipeContext->setSelectedSwiperDescription:' method
 */
- (void)selectSwiperAndGetCsn:(void(^)(HPSwiperResult*))block isShow:(BOOL)show
__attribute__((deprecated("HPSwipeContext responsablity to instance an swiper instnce. more detail watch:'HPSwipeContext->setSelectedSwiperDescription:' method")));
- (void)changeSwiperType:(SwiperType)swiperType
__attribute__((deprecated("instead of HPSwipeContext::setSelectedSwiperDescription")));
@end

#endif
